// DiplomacyContext.cs
//
// Copyright (c) 2007 Mike Strobel
//
// This source code is subject to the terms of the Microsoft Reciprocal License (Ms-RL).
// For details, see <http://www.opensource.org/licenses/ms-rl.html>.
//
// All other rights reserved.

using System;

using Supremacy.Entities;
using Supremacy.Game;

namespace Supremacy.Diplomacy
{
    [Serializable]
    public class DiplomacyContext
    {
        private readonly int _initiatingPartyId;
        private readonly int _otherPartyId;
        private readonly bool _isDemand;

        public DiplomacyContext(Civilization initiatingParty, Civilization otherParty, bool isDemand)
        {
            if (initiatingParty == null)
                throw new ArgumentNullException("initiatingParty");
            if (otherParty == null)
                throw new ArgumentNullException("otherParty");
            _initiatingPartyId = initiatingParty.CivID;
            _otherPartyId = otherParty.CivID;
            _isDemand = isDemand;
        }

        public Civilization InitiatingParty
        {
            get { return GameContext.Current.Civilizations[_initiatingPartyId]; }
        }

        public Civilization OtherParty
        {
            get { return GameContext.Current.Civilizations[_otherPartyId]; }
        }

        public bool IsDemand
        {
            get { return _isDemand; }
        }

        public Relationship InitiatingPartyRelationship
        {
            get { return GameContext.Current.Relationships[_initiatingPartyId, _otherPartyId]; }
        }

        public Relationship OtherPartyRelationship
        {
            get { return GameContext.Current.Relationships[_otherPartyId, _initiatingPartyId]; }
        }
    }
}
